{extend name="admin@public/base" /}
{block name="main-content"}
<div class="page-content">
    <div class="row">
        <div class="col-xs-12">
            
            <div class="row">
                <div class="col-sm-6 widget-container-col ui-sortable">
                    <div class="widget-box" id="widget-box-2">
                        <div class="widget-header">
                            <h5 class="widget-title bigger lighter ui-sortable-handle">
                                <i class="ace-icon fa fa-table"></i>
                                审批
                            </h5>
                            <div class="widget-toolbar no-border">
                                <ul class="nav nav-tabs" id="recent-tab">
                                    <li class="active">
                                        <a data-toggle="tab" href="#over-tab" aria-expanded="false">超时</a>
                                    </li>
                                    <li class="">
                                        <a data-toggle="tab" href="#task-tab" aria-expanded="true">待办</a>
                                    </li>
                                    <li class="">
                                        <a data-toggle="tab" href="#member-tab" aria-expanded="false">已办</a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        <div class="widget-body">
                            <div class="widget-main no-padding">
                                <div class="tab-content no-padding">
                                    <div id="over-tab" class="tab-pane active">
                                        <table class="table table-striped table-bordered table-hover">
                                            <thead class="thin-border-bottom">
                                                <tr>
                                                    <th class="center">事项编号</th>
                                                    <th class="center">事项名称</th>
                                                    <th class="center">当前节点</th>
                                                    <th class="center">当前办理人</th>
                                                    <th class="center">停留天数</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                {if condition="$over_list"}
                                                    {foreach $over_list as $list}
                                                    <tr>
                                                        <td class="center"><a href="{:url('case_list/needToDo',['order_id'=>$list['order_id']])}" target="_blank">{$list.order_id}</a></td>
                                                        <td class="center">{$list.type_name}</td>
                                                        <td class="center">{$list.node_name}</td>
                                                        <td class="center">{$list.user_name}</td>
                                                        <td class="center"><span class="label label-sm label-danger">{$list.stop_day}</span></td>
                                                    </t> 
                                                    {/foreach}
                                                {else}
                                                    <tr>
                                                        <td colspan="5" class="center">未发现有超时事项</td>
                                                    </t>   
                                                {/if}
                                            </tbody>
                                        </table>
                                    </div>
                                    <div id="task-tab" class="tab-pane">
                                        <table class="table table-striped table-bordered table-hover">
                                            <thead class="thin-border-bottom">
                                                <tr>
                                                    <th class="center">事项编号</th>
                                                    <th class="center">事项名称</th>
                                                    <th class="center">当前节点</th>
                                                    <th class="center">当前办理人</th>
                                                    <th class="center">状态</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                {if condition="$need_list"}
                                                    {foreach $need_list as $list}
                                                    <tr>
                                                        <td class="center"><a href="{:url('case_list/needToDo',['order_id'=>$list['order_id']])}" target="_blank">{$list.order_id}</a></td>
                                                        <td class="center">{$list.info}</td>
                                                        <td class="center">{$list.node_name}</td>
                                                        <td class="center">{$list.node_user}</td>
                                                        <td class="center">{$list.status_text}</td>
                                                    </t> 
                                                    {/foreach}
                                                {else}
                                                    <tr>
                                                        <td colspan="5" class="center">未发现有待办事项</td>
                                                    </t>   
                                                {/if}
                                            </tbody>
                                        </table>
                                    </div>
                                    <div id="member-tab" class="tab-pane">
                                        <table class="table table-striped table-bordered table-hover">
                                            <thead class="thin-border-bottom">
                                                <tr>
                                                    <th class="center">事项编号</th>
                                                    <th class="center">事项名称</th>
                                                    <th class="center">当前节点</th>
                                                    <th class="center">当前办理人</th>
                                                    <th class="center">状态</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                {if condition="$done_list"}
                                                    {foreach $done_list as $list}
                                                    <tr>
                                                        <td class="center"><a href="{:url('case_list/Done',['order_id'=>$list['order_id']])}" target="_blank">{$list.order_id}</a></td>
                                                        <td class="center">{$list.info}</td>
                                                        <td class="center">{$list.node_name}</td>
                                                        <td class="center">{$list.node_user}</td>
                                                        <td class="center">{$list.status_text}</td>
                                                    </t> 
                                                    {/foreach}
                                                {else}
                                                    <tr>
                                                        <td colspan="5" class="center">未发现有已办事项</td>
                                                    </t>   
                                                {/if}
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- 消息 -->
                <div class="col-sm-6 widget-container-col ui-sortable">
                    <div class="widget-box widget-color-blue2">
                        <div class="widget-header">
                            <h5 class="widget-title bigger lighter sl-font14">
                                <i class="ace-icon fa fa-envelope-o red"></i>
                                <span style="font-size:14px; font-family:Microsoft YaHei">公告消息</span>
                            </h5>
                            <div class="widget-toolbar no-border">
                                <ul class="nav nav-tabs" id="recent-tab">
                                    <li class="active" onclick="getMessageListByType(1, 10)">
                                        <a data-toggle="tab" href="#gonggao-tab" aria-expanded="true">通知公告</a>
                                    </li>
                                    <li onclick="getMessageListByType(2, 10)">
                                        <a data-toggle="tab" href="#zhanneixiaoxi-tab" aria-expanded="false">站内消息</a>
                                    </li>
                                    <li onclick="getMessageListByType(3, 10)">
                                        <a data-toggle="tab" href="#xitongxiaoxi-tab" aria-expanded="false">系统消息</a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        <div class="widget-body">
                            <div class="widget-main no-padding">
                                <div class="tab-content no-padding">
                                    <div id="gonggao-tab" class="tab-pane active">
                                        <table class="table table-striped table-bordered table-hover" style="table-layout: fixed;">
                                            <thead class="thin-border-bottom">
                                                <tr>
                                                    <th class = "center" width="6%"></th>
                                                    <th class = "center" width="65%">标题</th>
                                                    <th class = "center" width="25%"><em>发送时间</em></th>
                                                </tr>
                                            </thead>
                                            <tbody id = 'msg-list-1'>
                                                {if condition="!empty($messageContentList)"}
                                                {foreach name="messageContentList" item="v" key="k"}
                                                <tr>
                                                    <td>
                                                        <span class="badge badge-danger">{$k+1}</span>
                                                    </td>
                                                    <td style="word-wrap: break-word;">
                                                        <a href="javascript:void(0);" onclick="view_message_info({$v.id},'mylist')">{$v.title}</a>
                                                    </td>
                                                    <td class = "center">{:date('Y-m-d H:i',$v.send_time)}</td>
                                                </tr>
                                                {/foreach}
                                                {else/}
                                                <tr><td class= 'center' colspan = '3'>未查找到最新消息</td></tr>
                                                {/if}
                                            </tbody>
                                        </table>
                                    </div>
                                    <div id="zhanneixiaoxi-tab" class="tab-pane">
                                        <table class="table table-striped table-bordered table-hover" style="table-layout: fixed;">
                                            <thead class="thin-border-bottom">
                                                <tr>
                                                    <th class = "center" width="6%"></th>
                                                    <th class = "center" width="65%">标题</th>
                                                    <th class = "center" width="25%"><em>发送时间</em></th>
                                                </tr>
                                            </thead>
                                            <tbody id = 'msg-list-2'>
                                            </tbody>
                                        </table>
                                    </div>
                                    <div id="xitongxiaoxi-tab" class="tab-pane">
                                        <table class="table table-striped table-bordered table-hover" style="table-layout: fixed;">
                                            <thead class="thin-border-bottom">
                                                <tr>
                                                    <th class = "center" width="6%"></th>
                                                    <th class = "center" width="65%">标题</th>
                                                    <th class = "center" width="25%"><em>发送时间</em></th>
                                                </tr>
                                            </thead>
                                            <tbody id ='msg-list-3'>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div><!-- /.col -->
    </div><!-- /.row -->
</div>
{/block}
{block name="scripts"}
<script>
    function view_message_info(message_id, type) {
        var title = "消息详情";
        var url = '{:url("Message/viewMessageInfo")}?messageId=' + message_id + '&type=' + type;
        layer.open({
            type: 2,
            skin: 'layui-layer-rim', //加上边框
            shadeClose: true,
            shade: 0.5,
            anim: 2,
            area: ['65%', '80%'],
            title: title,
            content: url,
            end: function() {
                //location.reload();
            }
        });
    }

    function getMessageListByType(type, show_num)
    {
        $.ajax({
            type: "POST",
            url: '{:url("admin/Message/ajaxGetUnreadListByType")}',
            data: {'type': type, 'show_num': show_num},
            dataType: "JSON",
            success: function(result)
            {
                var content_html = '';
                if (result.code == 1) {
                    for (var i = 0; i < result.data.length; i++) {
                        var c_id = result.data[i].id;
                        var c_title = result.data[i].title;
                        var send_time = result.data[i].send_time;
                        content_html += "<tr><td height='25'><span class='badge badge-danger'>" + (i + 1) + "</span></td>" +
                                "<td><a href='javascript:void(0);' style='display: block;word-wrap: break-word;' onclick=\"view_message_info(" + c_id + ",'mylist')\">" + c_title + "</a></td>" +
                                "<td class='center'>" + send_time + "</td></tr>";
                    }
                    $('#msg-list-' + type).html(content_html);
                } else {
                    content_html = "<tr><td class= 'center' colspan = '3'>未查找到最新消息</td></tr>";
                    $('#msg-list-' + type).html(content_html);
                }
            }
        });
    }
</script>
{/block}